3.24 \(\int x^2 \sin ^2(\frac{1}{4}+x+x^2) \, dx\)

Optimal. Leaf size=85 \[ -\frac{1}{16} \sqrt{\pi } \text{FresnelC}\left (\frac{2 x+1}{\sqrt{\pi }}\right )+\frac{1}{16} \sqrt{\pi } S\left (\frac{2 x+1}{\sqrt{\pi }}\right )+\frac{x^3}{6}-\frac{1}{8} x \sin \left (2 x^2+2 x+\frac{1}{2}\right )+\frac{1}{16} \sin \left (2 x^2+2 x+\frac{1}{2}\right ) \]

[Out]

x^3/6 - (Sqrt[Pi]*FresnelC[(1 + 2*x)/Sqrt[Pi]])/16 + (Sqrt[Pi]*FresnelS[(1 + 2*x)/Sqrt[Pi]])/16 + Sin[1/2 + 2*
x + 2*x^2]/16 - (x*Sin[1/2 + 2*x + 2*x^2])/8

________________________________________________________________________________________

Rubi [A]  time = 0.0619234, antiderivative size = 85, normalized size of antiderivative = 1., number of steps used = 8, number of rules used = 7, integrand size = 15, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.467, Rules used = {3467, 3464, 3445, 3351, 3462, 3446, 3352} \[ -\frac{1}{16} \sqrt{\pi } \text{FresnelC}\left (\frac{2 x+1}{\sqrt{\pi }}\right )+\frac{1}{16} \sqrt{\pi } S\left (\frac{2 x+1}{\sqrt{\pi }}\right )+\frac{x^3}{6}-\frac{1}{8} x \sin \left (2 x^2+2 x+\frac{1}{2}\right )+\frac{1}{16} \sin \left (2 x^2+2 x+\frac{1}{2}\right ) \]

Antiderivative was successfully verified.

[In]

Int[x^2*Sin[1/4 + x + x^2]^2,x]

[Out]

x^3/6 - (Sqrt[Pi]*FresnelC[(1 + 2*x)/Sqrt[Pi]])/16 + (Sqrt[Pi]*FresnelS[(1 + 2*x)/Sqrt[Pi]])/16 + Sin[1/2 + 2*
x + 2*x^2]/16 - (x*Sin[1/2 + 2*x + 2*x^2])/8

Rule 3467

Int[((d_.) + (e_.)*(x_))^(m_.)*Sin[(a_.) + (b_.)*(x_) + (c_.)*(x_)^2]^(n_), x_Symbol] :> Int[ExpandTrigReduce[
(d + e*x)^m, Sin[a + b*x + c*x^2]^n, x], x] /; FreeQ[{a, b, c, d, e, m}, x] && IGtQ[n, 1]

Rule 3464

Int[Cos[(a_.) + (b_.)*(x_) + (c_.)*(x_)^2]*((d_.) + (e_.)*(x_))^(m_), x_Symbol] :> Simp[(e*(d + e*x)^(m - 1)*S
in[a + b*x + c*x^2])/(2*c), x] + (-Dist[(e^2*(m - 1))/(2*c), Int[(d + e*x)^(m - 2)*Sin[a + b*x + c*x^2], x], x
] - Dist[(b*e - 2*c*d)/(2*c), Int[(d + e*x)^(m - 1)*Cos[a + b*x + c*x^2], x], x]) /; FreeQ[{a, b, c, d, e}, x]
 && NeQ[b*e - 2*c*d, 0] && GtQ[m, 1]

Rule 3445

Int[Sin[(a_.) + (b_.)*(x_) + (c_.)*(x_)^2], x_Symbol] :> Int[Sin[(b + 2*c*x)^2/(4*c)], x] /; FreeQ[{a, b, c},
x] && EqQ[b^2 - 4*a*c, 0]

Rule 3351

Int[Sin[(d_.)*((e_.) + (f_.)*(x_))^2], x_Symbol] :> Simp[(Sqrt[Pi/2]*FresnelS[Sqrt[2/Pi]*Rt[d, 2]*(e + f*x)])/
(f*Rt[d, 2]), x] /; FreeQ[{d, e, f}, x]

Rule 3462

Int[Cos[(a_.) + (b_.)*(x_) + (c_.)*(x_)^2]*((d_.) + (e_.)*(x_)), x_Symbol] :> Simp[(e*Sin[a + b*x + c*x^2])/(2
*c), x] + Dist[(2*c*d - b*e)/(2*c), Int[Cos[a + b*x + c*x^2], x], x] /; FreeQ[{a, b, c, d, e}, x] && NeQ[2*c*d
 - b*e, 0]

Rule 3446

Int[Cos[(a_.) + (b_.)*(x_) + (c_.)*(x_)^2], x_Symbol] :> Int[Cos[(b + 2*c*x)^2/(4*c)], x] /; FreeQ[{a, b, c},
x] && EqQ[b^2 - 4*a*c, 0]

Rule 3352

Int[Cos[(d_.)*((e_.) + (f_.)*(x_))^2], x_Symbol] :> Simp[(Sqrt[Pi/2]*FresnelC[Sqrt[2/Pi]*Rt[d, 2]*(e + f*x)])/
(f*Rt[d, 2]), x] /; FreeQ[{d, e, f}, x]

Rubi steps

\begin{align*} \int x^2 \sin ^2\left (\frac{1}{4}+x+x^2\right ) \, dx &=\int \left (\frac{x^2}{2}-\frac{1}{2} x^2 \cos \left (\frac{1}{2}+2 x+2 x^2\right )\right ) \, dx\\ &=\frac{x^3}{6}-\frac{1}{2} \int x^2 \cos \left (\frac{1}{2}+2 x+2 x^2\right ) \, dx\\ &=\frac{x^3}{6}-\frac{1}{8} x \sin \left (\frac{1}{2}+2 x+2 x^2\right )+\frac{1}{8} \int \sin \left (\frac{1}{2}+2 x+2 x^2\right ) \, dx+\frac{1}{4} \int x \cos \left (\frac{1}{2}+2 x+2 x^2\right ) \, dx\\ &=\frac{x^3}{6}+\frac{1}{16} \sin \left (\frac{1}{2}+2 x+2 x^2\right )-\frac{1}{8} x \sin \left (\frac{1}{2}+2 x+2 x^2\right )-\frac{1}{8} \int \cos \left (\frac{1}{2}+2 x+2 x^2\right ) \, dx+\frac{1}{8} \int \sin \left (\frac{1}{8} (2+4 x)^2\right ) \, dx\\ &=\frac{x^3}{6}+\frac{1}{16} \sqrt{\pi } S\left (\frac{1+2 x}{\sqrt{\pi }}\right )+\frac{1}{16} \sin \left (\frac{1}{2}+2 x+2 x^2\right )-\frac{1}{8} x \sin \left (\frac{1}{2}+2 x+2 x^2\right )-\frac{1}{8} \int \cos \left (\frac{1}{8} (2+4 x)^2\right ) \, dx\\ &=\frac{x^3}{6}-\frac{1}{16} \sqrt{\pi } C\left (\frac{1+2 x}{\sqrt{\pi }}\right )+\frac{1}{16} \sqrt{\pi } S\left (\frac{1+2 x}{\sqrt{\pi }}\right )+\frac{1}{16} \sin \left (\frac{1}{2}+2 x+2 x^2\right )-\frac{1}{8} x \sin \left (\frac{1}{2}+2 x+2 x^2\right )\\ \end{align*}

Mathematica [A]  time = 0.144895, size = 77, normalized size = 0.91 \[ \frac{1}{48} \left (-3 \sqrt{\pi } \text{FresnelC}\left (\frac{2 x+1}{\sqrt{\pi }}\right )+3 \sqrt{\pi } S\left (\frac{2 x+1}{\sqrt{\pi }}\right )+8 x^3-6 x \sin \left (\frac{1}{2} (2 x+1)^2\right )+3 \sin \left (\frac{1}{2} (2 x+1)^2\right )\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[x^2*Sin[1/4 + x + x^2]^2,x]

[Out]

(8*x^3 - 3*Sqrt[Pi]*FresnelC[(1 + 2*x)/Sqrt[Pi]] + 3*Sqrt[Pi]*FresnelS[(1 + 2*x)/Sqrt[Pi]] + 3*Sin[(1 + 2*x)^2
/2] - 6*x*Sin[(1 + 2*x)^2/2])/48

________________________________________________________________________________________

Maple [A]  time = 0.017, size = 64, normalized size = 0.8 \begin{align*}{\frac{{x}^{3}}{6}}+{\frac{1}{16}\sin \left ({\frac{1}{2}}+2\,x+2\,{x}^{2} \right ) }-{\frac{x}{8}\sin \left ({\frac{1}{2}}+2\,x+2\,{x}^{2} \right ) }-{\frac{\sqrt{\pi }}{16}{\it FresnelC} \left ({\frac{1+2\,x}{\sqrt{\pi }}} \right ) }+{\frac{\sqrt{\pi }}{16}{\it FresnelS} \left ({\frac{1+2\,x}{\sqrt{\pi }}} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x^2*sin(1/4+x+x^2)^2,x)

[Out]

1/6*x^3+1/16*sin(1/2+2*x+2*x^2)-1/8*x*sin(1/2+2*x+2*x^2)-1/16*FresnelC((1+2*x)/Pi^(1/2))*Pi^(1/2)+1/16*Fresnel
S((1+2*x)/Pi^(1/2))*Pi^(1/2)

________________________________________________________________________________________

Maxima [C]  time = 2.32955, size = 231, normalized size = 2.72 \begin{align*} \frac{8192 \, x^{4} + 4096 \, x^{3} - x{\left (3072 i \, e^{\left (2 i \, x^{2} + 2 i \, x + \frac{1}{2} i\right )} - 3072 i \, e^{\left (-2 i \, x^{2} - 2 i \, x - \frac{1}{2} i\right )}\right )} - \sqrt{8 \, x^{2} + 8 \, x + 2}{\left (-\left (192 i - 192\right ) \, \sqrt{2} \sqrt{\pi }{\left (\operatorname{erf}\left (\sqrt{2 i \, x^{2} + 2 i \, x + \frac{1}{2} i}\right ) - 1\right )} + \left (192 i + 192\right ) \, \sqrt{2} \sqrt{\pi }{\left (\operatorname{erf}\left (\sqrt{-2 i \, x^{2} - 2 i \, x - \frac{1}{2} i}\right ) - 1\right )} + \left (384 i + 384\right ) \, \sqrt{2} \Gamma \left (\frac{3}{2}, 2 i \, x^{2} + 2 i \, x + \frac{1}{2} i\right ) - \left (384 i - 384\right ) \, \sqrt{2} \Gamma \left (\frac{3}{2}, -2 i \, x^{2} - 2 i \, x - \frac{1}{2} i\right )\right )} - 1536 i \, e^{\left (2 i \, x^{2} + 2 i \, x + \frac{1}{2} i\right )} + 1536 i \, e^{\left (-2 i \, x^{2} - 2 i \, x - \frac{1}{2} i\right )}}{24576 \,{\left (2 \, x + 1\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^2*sin(1/4+x+x^2)^2,x, algorithm="maxima")

[Out]

1/24576*(8192*x^4 + 4096*x^3 - x*(3072*I*e^(2*I*x^2 + 2*I*x + 1/2*I) - 3072*I*e^(-2*I*x^2 - 2*I*x - 1/2*I)) -
sqrt(8*x^2 + 8*x + 2)*(-(192*I - 192)*sqrt(2)*sqrt(pi)*(erf(sqrt(2*I*x^2 + 2*I*x + 1/2*I)) - 1) + (192*I + 192
)*sqrt(2)*sqrt(pi)*(erf(sqrt(-2*I*x^2 - 2*I*x - 1/2*I)) - 1) + (384*I + 384)*sqrt(2)*gamma(3/2, 2*I*x^2 + 2*I*
x + 1/2*I) - (384*I - 384)*sqrt(2)*gamma(3/2, -2*I*x^2 - 2*I*x - 1/2*I)) - 1536*I*e^(2*I*x^2 + 2*I*x + 1/2*I)
+ 1536*I*e^(-2*I*x^2 - 2*I*x - 1/2*I))/(2*x + 1)

________________________________________________________________________________________

Fricas [A]  time = 1.65278, size = 215, normalized size = 2.53 \begin{align*} \frac{1}{6} \, x^{3} - \frac{1}{8} \,{\left (2 \, x - 1\right )} \cos \left (x^{2} + x + \frac{1}{4}\right ) \sin \left (x^{2} + x + \frac{1}{4}\right ) - \frac{1}{16} \, \sqrt{\pi } \operatorname{C}\left (\frac{2 \, x + 1}{\sqrt{\pi }}\right ) + \frac{1}{16} \, \sqrt{\pi } \operatorname{S}\left (\frac{2 \, x + 1}{\sqrt{\pi }}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^2*sin(1/4+x+x^2)^2,x, algorithm="fricas")

[Out]

1/6*x^3 - 1/8*(2*x - 1)*cos(x^2 + x + 1/4)*sin(x^2 + x + 1/4) - 1/16*sqrt(pi)*fresnel_cos((2*x + 1)/sqrt(pi))
+ 1/16*sqrt(pi)*fresnel_sin((2*x + 1)/sqrt(pi))

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int x^{2} \sin ^{2}{\left (x^{2} + x + \frac{1}{4} \right )}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x**2*sin(1/4+x+x**2)**2,x)

[Out]

Integral(x**2*sin(x**2 + x + 1/4)**2, x)

________________________________________________________________________________________

Giac [C]  time = 1.35223, size = 86, normalized size = 1.01 \begin{align*} \frac{1}{6} \, x^{3} - \frac{1}{32} \,{\left (-2 i \, x + i\right )} e^{\left (2 i \, x^{2} + 2 i \, x + \frac{1}{2} i\right )} - \frac{1}{32} \,{\left (2 i \, x - i\right )} e^{\left (-2 i \, x^{2} - 2 i \, x - \frac{1}{2} i\right )} + \frac{1}{32} i \, \sqrt{\pi } \operatorname{erf}\left (\left (i - 1\right ) \, x + \frac{1}{2} i - \frac{1}{2}\right ) - \frac{1}{32} i \, \sqrt{\pi } \operatorname{erf}\left (-\left (i + 1\right ) \, x - \frac{1}{2} i - \frac{1}{2}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^2*sin(1/4+x+x^2)^2,x, algorithm="giac")

[Out]

1/6*x^3 - 1/32*(-2*I*x + I)*e^(2*I*x^2 + 2*I*x + 1/2*I) - 1/32*(2*I*x - I)*e^(-2*I*x^2 - 2*I*x - 1/2*I) + 1/32
*I*sqrt(pi)*erf((I - 1)*x + 1/2*I - 1/2) - 1/32*I*sqrt(pi)*erf(-(I + 1)*x - 1/2*I - 1/2)